import { FormLayout } from 'ng-devui';
import { UserService } from './../../../../@core/services/user/user.service';
import { Component, Input } from '@angular/core';

@Component({
  selector: 'app-add-review-flow-roles',
  templateUrl: './add-review-flow-roles.component.html',
  styleUrls: ['./add-review-flow-roles.component.scss']
})
export class AddReviewFlowRolesComponent {
  @Input() data:any
  disabled = false;
  sourceOption = []
  targetOption = [];
  layoutDirection: FormLayout = FormLayout.Horizontal;
  CreateApprovalGroup:any={
    name:'',
    userAccountNumber:[]
  }
  constructor( private UserService:UserService) {}
  ngOnInit(): void {
    this.UserService.GetAllEmploy(1,9999).subscribe((data:any)=>{
      this.sourceOption = data.items.map((item: { accountNumber: any; }) => {
        return { ...item, value: item.accountNumber, accountNumber: undefined };
      });
    })
  }

  transferToTarget(data: any) {
    this.CreateApprovalGroup.userAccountNumber=data.targetOption.map((item: { value: any; }) => item.value);
  }

  transferToSource(data: any) {
    this.CreateApprovalGroup.userAccountNumber=data.targetOption.map((item: { value: any; }) => item.value);
  }


  onChange(event: any) {
    this.disabled = event;
  }
}
